//
//  ZxHomePageNetManager.m
//  XiMaFM
//
//  Created by fanzhuxian on 2017/9/4.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "ZxHomePageNetManager.h"

#import "ZxFmLiveModel.h"
#import "ZxFmLiveHeaderModel.h"

#import "ZXClassifyModel.h"
#import "ZXClassifyViewModel.h"

#import "ZXBoutiqueModel.h"
#import "ZXBoutiqueSpecialModel.h"

#import <MJExtension.h>

// ?号前网址
#define kHomeURLPath @"http://mobile.ximalaya.com/mobile/discovery/v1/recommends"

#define kCategoryURLPath @"http://mobile.ximalaya.com/mobile/discovery/v1/categories"

#define kNickURLPath @"http://mobile.ximalaya.com/mobile/discovery/v3/category/recommends/ts-1498269505810?categoryId=33&contentType=album&device=iPhone&scale=2&version=6.3.6"

#define KboutiquePath @"http://mobile.ximalaya.com/mobile/discovery/v1/category/filter/albums/ts-1498304867750?calcDimension=hot&categoryId=33&device=iPhone&keywordId=398&pageId=1&pageSize=20&version=6.3.6"

#define KBroadURLPath @"http://live.ximalaya.com/live-web/v4/homepage?device=iPhone"

#define kLiveURLPath @"http://mobile.ximalaya.com/lamia/v4/live/homepage?device=iPhone&pageId=1&pageSize=30&timeToPreventCaching=1498314478.848482"

#define kLiveRollingURLPath @"http://mobile.ximalaya.com/mobile/discovery/v1/focus/list?device=iPhone&timeToPreventCaching=1498314478.844912&type=personal_live&version=6.3.6"


#define kURLVersion @"version":@"4.3.26.2"
#define kURLDevice @"device":@"ios"
#define kURLSpecial @"includeSpecial":@"true"
#define kURLActivity @"includeActivity":@"true"
#define kURLScale @"scale":@2
#define kURLPage @"page":@1
#define kURLPicVersion @"picVersion":@11
#define KURLChannel @"channel":@"and-f5"   // 会变 貌似不影响

@implementation ZxHomePageNetManager

/**  从网络上获取直播滚动图信息 */
// http://mobile.ximalaya.com/mobile/discovery/v1/focus/list?device=iPhone&timeToPreventCaching=1498314478.844912&type=personal_live&version=6.3.6
+ (id)getLivePageCompletionHandle:(void(^)(id responseObject, NSError *error))completed {
    return [self GET:kLiveRollingURLPath parameters:nil complationHandle:^(id responseObject, NSError *error) {
        completed([ZxFmLiveHeaderModel mj_objectWithKeyValues:responseObject],error);
    }];
}
/**  从网络上获取直播信息 */
//http://180.153.255.6/lamia/v4/live/homepage?device=iPhone&pageId=1&pageSize=30&timeToPreventCaching=1498314478.848482
+ (id)getLiveCompletionHandle:(void(^)(id responseObject, NSError *error))completed {
    return [self GET:kLiveURLPath parameters:nil complationHandle:^(id responseObject, NSError *error) {
        completed([ZxFmLiveModel mj_objectWithKeyValues:responseObject],error);
    }];
}

/**  从网络上获得分类信息 */
//http://mobile.ximalaya.com/mobile/discovery/v1/categories?device=android&picVersion=11&scale=2
+ (id)getCategoryPageCompletionHandle:(void(^)(id responseObject, NSError *error))completed {
    return [self GET:kCategoryURLPath parameters:@{kURLDevice,kURLPicVersion,kURLScale} complationHandle:^(id responseObject, NSError *error) {
        completed([ZXClassifyModel mj_objectWithKeyValues:responseObject], error);
    }];
}

/** 从网络上获得精品信息 */
// http://mobile.ximalaya.com/mobile/discovery/v3/category/recommends/ts-1498269505810?categoryId=33&contentType=album&device=iPhone&scale=2&version=6.3.6
+ (id)getAnchorPageCompletionHandle:(void(^)(id responseObject, NSError *error))completed {
    return [self GET:kNickURLPath parameters:nil complationHandle:^(id responseObject, NSError *error) {
        completed([ZXBoutiqueModel mj_objectWithKeyValues:responseObject],error);
    }];
}


/** 从网络上获得精品详细信息 */
// http://mobile.ximalaya.com/mobile/discovery/v1/category/filter/albums/ts-1498304867750?calcDimension=hot&categoryId=33&device=iPhone&keywordId=398&pageId=1&pageSize=20&version=6.3.6
+ (id)getBoutiquePageCompletionHandle:(void(^)(id responseObject, NSError *error))completed {
    return [self GET:KboutiquePath parameters:nil complationHandle:^(id responseObject, NSError *error) {
        completed([ZXBoutiqueSpecialModel mj_objectWithKeyValues:responseObject],error);
    }];
}

@end
